package ejercicios;

import interfaces.tests.CountOfOnes;

public class CountOfOnesImpl implements CountOfOnes {
	public int countOfOnes(int n){
    	int count = 0;
    	int current = n;
    	int moved;
    	while (current != 0){
    		moved = current >> 1;
    		if (moved % 2 == 0){
    			count++;
    		}
    		current-= moved;
    	}
    	return count;
    }
}